<?php
class CommonController{
public function __call($name, $arguments)
{
$this->redirect('index.php','您访问的'.$name.'方法不存在');
}

    protected function dataToFile ( $data , $file = './data.php' )
    {
        $newData = var_export ( $data , true );
        $str
            = <<<str
<?php
return $newData;
str;
        file_put_contents ( $file , $str );
    }



    protected function redirect($url, $message, $time = 3, $arg = '')
    {
        //$url     = $url.'&'.$arg;
        $url     = $arg ? $url.'&'.$arg : $url;
        $time    *= 1000;
        $content = "
        <h2>{$message}</h2>
    <p><span id='time'>3</span>秒后将进行跳转</p>
    <p><a href='{$url}'>点击跳转</a></p>
    <script>
    	setInterval(function(){
    	    var time = document.getElementById('time').innerHTML;
    	    time--;
    	    document.getElementById('time').innerHTML=time;
    	},1000)
        setTimeout(function(){
            location.href='{$url}';
        },{$time})
    </script>";
        die($content);
    }
}